package com.unionpay.db;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;

/**
 * @author zhengdechao
 * @createTime : 2019-05-14
 *
 */

@Component
@Aspect
public class AspectDataSource {
	@Before("@annotation(com.unionpay.db.DataSource)")
	public void before(JoinPoint joinPoint) {
		MethodSignature signature = (MethodSignature) joinPoint.getSignature();
		System.err.println(signature.getMethod().getAnnotation(DataSource.class).value());
		DyHolder.setDataSource(signature.getMethod().getAnnotation(DataSource.class).value());
	}
}
